//
//
//
//
//
//
//
//
//
//
import Popup from '../internal/popup'
export default {
name: 'mu-popup',
mixins: [Popup],
props: {
popupClass: {
type: [String, Object, Array]
},
popupTransition: {
type: String,
default: ''
},
position: {
type: String,
default: ''
}
},
data () {
return {
transition: this.popupTransition
}
},
created () {
if (!this.popupTransition) {
this.transition = `popup-slide-${this.position}`
}
},
computed: {
popupCss () {
const {position, popupClass} = this
let classNames = []
if (position) classNames.push('mu-popup-' + position)
if (!popupClass) return classNames
if (popupClass instanceof Object) {
for (const name in popupClass) {
if (popupClass[name]) classNames.push(name)
}
} else if (popupClass instanceof Array) {
classNames = classNames.concat(popupClass)
} else {
classNames = classNames.join(' ') + ' ' + popupClass
}
return classNames
}
},
methods: {
overlayClick () {
this.$emit('close', 'overlay')
},
escPress () {
this.$emit('close', 'esc')
},
show () {
this.$emit('show')
},
hide () {
this.$emit('hide')
}
},
watch: {
popupTransition (val, oldVal) {
if (val === oldVal) return
this.transition = val
}
}
}
|